package com.hqyj.Dao;
//duty表操作
import com.hqyj.Pojo.Duty;
import com.hqyj.Pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;

public interface DutyDao {
    @Select("SELECT * FROM duty WHERE role_id=#{roleid}")
    List<Duty> querByRoleId(int roleid);

    @Select("SELECT *FROM user WHERE role_id>#{roleid}")
    List<User> queryUserByRoleId(int roleid);

    @Delete("DELETE FROM user WHERE user_id=#{user_id}")
    void delete(int user_id);

    @Update("UPDATE user SET name=#{name},sex=#{sex},mail=#{mail},age=#{age}," +
            "address=#{address},role_id=#{role_id},role_name=#{role_name} WHERE user_id=#{user_id}")
    void update(User users);

    @Select("SELECT * FROM user WHERE name LIKE CONCAT('%',#{name},'%') AND role_id>=#{role_id}")
    List<User> queryByName(User user1);

    @Select("SELECT * FROM user WHERE role_name LIKE CONCAT('%',#{role_name},'%') AND role_id>#{role_id}")
    List<User> queryByRole_name(User user1);

    @Select("SELECT * FROM user WHERE mail=#{mail} AND role_id>#{role_id}")
    List<User> queryByMail(User user1);

    @Select("SELECT * FROM user WHERE age=#{age} AND role_id>#{role_id}")
    List<User> queryByAge(User user1);

    @Select("SELECT * FROM user WHERE role_name=#{role_name} AND role_id>#{role_id}")
    List<User> queryByAllRoleNname(User user1);

    @Update("UPDATE user SET username=#{username},password=#{password},name=#{name},sex=#{sex},mail=#{mail},age=#{age}," +
            "address=#{address} WHERE user_id=#{user_id}")
    void updateperson(User users);
}
